<?php

/**
 * Created by PhpStorm.
 * User: evan
 * Date: 2017/6/20
 * Time: 下午5:29
 */
class Bind extends MY_Api_Controller
{
    /**
     * 绑定中心首页
     */
    public function index()
    {
        $uid = $this->uid;


        $this->load->service('user/service_user_bind');
        $data = $this->service_user_bind->index($uid);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 绑定微信
     */
    public function bind_weixin()
    {
        $uid = $this->uid;
        $openid = trim($this->input->get_post('openid'));


        $this->load->service('user/service_user_bind');
        $data = $this->service_user_bind->bind_weixin($uid, $openid);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 解绑微信
     */
    public function unbind_weixin()
    {
        $uid    = $this->uid;
        $openid = trim($this->input->get_post('openid'));


        $this->load->service('user/service_user_bind');
        $data = $this->service_user_bind->unbind_weixin($uid, $openid);


        $this->json_output($data['data'], $data['status']);
    }
}